package com.zdd.ehe.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zdd.ehe.entity.Post;
import com.zdd.ehe.mapper.PostMapper;
import com.zdd.ehe.service.IPostService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ZhuiZhu
 * @since 2023-03-18
 */
@Service
public class PostServiceImpl extends ServiceImpl<PostMapper, Post> implements IPostService {

    @Resource
    private PostMapper postMapper;
    /**
     * 插入帖子数据
     *
     * @param post
     * @return
     */
    @Override
    public int insert(Post post) {
        int result = postMapper.insert(post);
        return result;
    }

    /**
     * 分页查询帖子列表
     *
     * @param page
     * @return
     */
    @Override
    public Page<Post> getAllPostByPage(Page<Post> page) {
        Page<Post> pagex = postMapper.getAllPostByPage(page);
        return pagex;
    }
}
